﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BCL.Repository;
using Azad;
using BCL.Entity;
using NazSoft.Framework.Extensions;
public partial class Archive : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            BindDropDown();
    }

    void BindDropDown()
    {
        SilverlightService silverlightService = new SilverlightService();
        dropdownDate.DataSource = silverlightService.ArchiveDate(null);
        dropdownDate.DataBind();
        dropdownDate.Items.Insert(0, "Please select date");
    }
    protected void GoButton_Click(object sender, EventArgs e)
    {
        DateTime newsDate = DateTime.Today.Date;
        if (DateTime.TryParse(dropdownDate.SelectedValue, out newsDate))
        {
            var navigateUrl = string.Format("/{0}/{1}/{2}/", newsDate.Year, newsDate.Month.ZeroPad(), newsDate.Day.ZeroPad());
            Response.Redirect(navigateUrl);
        }
    }
}